<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 
    JSP Name : cm_100_03.jsp
    Description : 커뮤니티 수정폼 입니다.
    author EUNGA
    since 2012. 7. 25.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 7. 25.     EUNGA     최초 생성
--%>
<%@ include file="/WEB-INF/jsp/co/mn/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/co/mn/include/session.jspf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/WEB-INF/jsp/co/mn/include/header.jspf" %>
<script type="text/javaScript" language="javascript">

$(document).ready(function() {    
    /* form validation check */
    onloadCharCheck();
     
    /* List Page 이동 */
    $("#listButn").bind("click", moveListPage);
    /* Form Submit */
    $("#rgstButn").bind("click", blcSubm);
    /* Form 초기화 */
    $("#cnclButn").bind("click", formIniz);
});

/*
 * 리스트페이지 이동
 */
function moveListPage() {
    $("#hiddenForm").attr('action','/cm_100_01.do').submit();
}

/*
 * Form Submit
 */
function blcSubm() {
    if (!validateForm($("#mainForm"))) {
        return;
    }
    
    if (!isSchrChk($("#titl").val())) {
        alert("[제목] 은 특수문자(!#$%^&*|'<>-;)를 입력할 수 없습니다.");
        $("#titl").focus();
        return;
    }
    
    if (getTxtBkmgRmov($("#sbc").val())=="") {
        alert("[내용] 을 입력해주세요.");
        $("#sbc").focus();
        return;
    }
    
    if (confirm("수정 하시겠습니까?")) {
        $("#mainForm").attr('target','comIframe');
        $("#mainForm").attr('action','/cm_100_07.do');
        $("#mainForm").submit();
    }
}  

/*
 * Form 초기화
 */
function formIniz() {
    $("form").each(function(){
       this.reset(); 
    });
}
</script>
</head>
<body>
<div id="wrap">
    <!-- top -->
    <%@ include file="/WEB-INF/jsp/co/mn/include/top.jsp" %>
    <!-- top -->
 
    <!-- container -->
    <div id="container">
        <!-- LNB -->
        <%@ include file="/WEB-INF/jsp/co/mn/include/left.jsp" %>
        <!-- LNB -->
        <div id="contents">
            <!-- location -->
            <%@ include file="/WEB-INF/jsp/co/mn/include/location.jsp" %>
            <!-- location -->
            <form id="hiddenForm" name="hiddenForm" method="post">
                <%-- request --%>
                <input type="hidden" id="blbIdx" name="blbIdx" value="${result.blbIdx }" />
                <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo }" />
                <input type="hidden" id="srchScn" name="srchScn" value="${rqInfo.srchScn }" />
                <input type="hidden" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" />
            </form>
            <p class="msgRequired"><span>*</span>표시는 필수 입력항목입니다</p>
            <form id="mainForm" name="mainForm" method="post" enctype="multipart/form-data">
                <%-- request --%>
                <input type="hidden" id="blbIdx" name="blbIdx" value="${result.blbIdx }" />
                <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo }" />
                <input type="hidden" id="srchScn" name="srchScn" value="${rqInfo.srchScn }" />
                <input type="hidden" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" />
            <table border="1" class="frmTable" summary="커뮤니티 관리의 기관명,이름,첨부파일,내용을 등록 하는 표">
                <col width="25%" />
                <col width="75%" />
                <tbody>
                    <tr>
                        <th><sup>*</sup>제목</th>
                        <td><input type="text" title="제목" maxlength="200" id="titl" name="titl" value="${result.titl }" nullable="true" minbyte="2" maxbyte="200"/></td>
                    </tr>
                    <tr>
                        <th>기관명</th>
                        <td>${result.instNm }<input type="hidden" id="instNm" name="instNm" value="${result.instNm }"/></td>
                    </tr>
                    <tr>
                        <th>이름</th>
                        <td>${result.pprrNm }<input type="hidden" id="pprrNm" name="pprrNm" value="${result.pprrNm }"/></td>
                    </tr>
                    <tr>
                        <th>정렬순서</th>
                        <td>
                            <select id="sortNum" name="sortNum" style="width:90px;">
                                <option value="1" <c:if test="${result.sortNum == 1 }"><c:out value="selected"/></c:if>>일반노출</option>
                                <option value="0" <c:if test="${result.sortNum <1 }"><c:out value="selected"/></c:if>>우선노출</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>첨부파일</th>
                        <td>
                            <div class="imgUpload">
                                <p><able:file name="attcFile" fixed="true" filename="" maxsize="30" sizeunit="M" sub="common" classType=""/></p>
                            </div>
                            <c:if test="${result.filNm != null }">
                                <p class="attachedFile"><a href="#" onclick="getUpFileDownload('0050','${result.blbIdx}');return false;">${result.filNm }</a></p>
                            </c:if>
                        </td>
                        <tr>
                        <th>이미지첨부</th>
                        <td>
                            <div class="imgUpload">
                                <p><able:file name="attcImage" fixed="true" filename="" maxsize="30" sizeunit="M" sub="common" classType=""/></p>
                            </div>
                            <c:if test="${result.thumnImgPath != null }">
                               <p class="attachedFile"><a href="#" onclick="getImgPopup('/upfile/image/${result.thumnImgNm }');return false;">${result.thumnImgNm }</a></p>
                            </c:if>
                        </td>
                    </tr>
                    </tr>
                    <tr>
                        <th><sup>*</sup>내용</th>
                        <td>
                            <textarea id="sbc" name="sbc" rows="25" cols="85">${result.sbc }</textarea>
                        </td>
                    </tr>
                </tbody>
            </table>
            </form>
            <div class="btnBoard">
                <span class="flow">
                    <input type="submit" id="listButn" name="listButn" title="목록" value="목록" />
                </span>
                <span class="reverse">
                    <input type="submit" id="rgstButn" name="rgstButn" title="등록" value="등록" />
                    <input type="submit" id="cnclButn" name="cnclButn" title="취소" value="취소" />
                </span>
            </div>
        </div>
    </div>
    <!-- /container -->
 
    <!-- footer -->
    <%@ include file="/WEB-INF/jsp/co/mn/include/bottom.jsp" %>
    <!-- /footer -->
</div>
</body>
</html>